package action;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import model.Assessor;
import model.ProjectInfo;
import model.UnAssess;
import model.User;
import action.base.BaseAction;

import com.opensymphony.xwork2.ActionContext;

public class UnAssessInfoList extends BaseAction {
	private List<ProjectInfo> projectInfos = new ArrayList<ProjectInfo>();
	public String execute() throws Exception{
		Map session = ActionContext.getContext().getSession();
		Assessor assessor = (Assessor)session.get("ASSESSOR");
		List<UnAssess> unAssesses =  mgu.getUnAssessByUser(assessor);
		if(unAssesses.size()>0){
			for(int i = 0;i<unAssesses.size();i++){
				User u = unAssesses.get(i).getUser();
				List<ProjectInfo> pros = mgp.getProjectByUser(u);
				projectInfos.add(pros.get(0));
			}
			session.put("PROJECTINFOS", projectInfos);
		}
		return "success";
	}
}
